﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Commerce.Base.Ubl.DataType
{
    /// <summary>
    /// A character string (letters, figures, or symbols) that for brevity and/or languange independence may be used to represent or replace a definitive value or text of an attribute together with relevant supplementary information.
    /// </summary>
    public class Code
    {
        protected string value;
        private Identifier listId;
        private Identifier listAgencyId;
        private Name listName;
        private Identifier listVersionId;
        private Name name;
        private Identifier languageId;
        private Identifier listUri;
        private Identifier listSchemeUri;

        /// <summary>
        /// The identification of a list of codes
        /// </summary>
        public Identifier ListId
        {
            get { return listId; }
            set { listId = value; }
        }

        /// <summary>
        /// An agency that maintains one or more lists of codes.
        /// </summary>
        public Identifier ListAgencyId
        {
            get { return listAgencyId; }
            set { listAgencyId = value; }
        }

        /// <summary>
        /// The name of a list of codes
        /// </summary>
        public Name ListName
        {
            get { return listName; }
            set { listName = value; }
        }

        /// <summary>
        /// The identification of a list of codes.
        /// </summary>
        public Identifier ListVersionId
        {
            get { return listVersionId; }
            set { listVersionId = value; }
        }

        /// <summary>
        /// The textual equivalent of the code content component.
        /// </summary>
        public Name Name
        {
            get { return name; }
            set { name = value; }
        }

        /// <summary>
        /// The identifier of the language used in the code name.
        /// </summary>
        public Identifier LanguageId
        {
            get { return languageId; }
            set { languageId = value; }
        }

        /// <summary>
        /// The Uniform Resource Identifier that identifies where the code list is located.
        /// </summary>
        public Identifier ListUri
        {
            get { return listUri; }
            set { listUri = value; }
        }

        /// <summary>
        /// The Uniform Resource Identifier that identifies where the code list scheme is located
        /// </summary>
        public Identifier ListSchemeUri
        {
            get { return listSchemeUri; }
            set { listSchemeUri = value; }
        }

        public override string ToString()
        {
            return this.value;
        }

        public static implicit operator Code(string value)
        {
            Code code = new Code();
            code.value = code;
            return code;
        }

        public static implicit operator string(Code code)
        {
            return code.value;
        }
    }
}
